import { Component, OnInit } from '@angular/core';
import {Resume} from '../../../entity/resume';
import {TalentService} from '../../../service/talent.service';
import {ActivatedRoute} from '@angular/router';

@Component({
  selector: 'app-edit-resume',
  templateUrl: '../add-resume/add-resume.component.html',
  styleUrls: ['./edit-resume.component.css', '../edit-info/edit-info.component.css']
})
export class EditResumeComponent implements OnInit {
  isEdit = true;
  resume: any = new Resume();
  constructor(
    public talentService: TalentService,
    private route: ActivatedRoute
  ) {
    this.getResume();
  }

  ngOnInit() {
  }
  editResume() {
    this.talentService.editResume(this.resume);
  }
  getResume() {
    const id = Number.parseInt( this.route.snapshot.paramMap.get('id'));
    this.talentService.findPositonOne(id)
      .subscribe(resume => this.resume = resume);
  }

}
